import { KaseoCommon2dGDI } from "../../dev/KaseoCanvasGraphicsDI";
import { KaseoRuntimeBridge } from "../../KaseoRuntime";
import { IRenderable, RenderLayoutContext } from "../IRenderable";
import RenderFlag from "../RenderFlag";

export interface WidgetCoord {
    x: number,
    y: number
}

export interface WidgetStyle {
    width: number | 'auto',
    height: number,
    canFocus?: boolean
}

export class WidgetState {
    focused: boolean = false
    renderNeeded: boolean = true
}

export default class WidgetBase implements IRenderable {
    public readonly style: WidgetStyle
    public readonly state: WidgetState = new WidgetState() 

    constructor(box: WidgetStyle) {
        this.style = box
    }

    protected requestRender() {
        this.state.renderNeeded = true
    }

    render(gdi: KaseoCommon2dGDI, ctx: RenderLayoutContext) {}

    onKonck(bridge: KaseoRuntimeBridge) {}
    onUpdate(bridge: KaseoRuntimeBridge) {}
}
